package com.slipper.system.log.service;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;

import com.slipper.system.log.dao.LoginLogDao;
import com.slipper.system.api.log.bo.LoginLogBO;

import com.slipper.common.transaction.ReadTransactional;
import com.slipper.common.transaction.WriteTransactional;
import com.slipper.common.util.Tool;

@Service
@ReadTransactional
public class LoginLogService {
    @Resource
    private LoginLogDao loginLogDao;
    
    public LoginLogBO queryBy(String id){
        return loginLogDao.queryBy(id);
    }
    
    public List<LoginLogBO> queryList(LoginLogBO bo){
        return loginLogDao.queryList(bo);
    }
    
    public PageInfo<LoginLogBO> queryPage(LoginLogBO bo){
        PageHelper.startPage(bo.getPageNumber(), bo.getPageSize());
        return new PageInfo<>(loginLogDao.queryList(bo));
    }
    
    @WriteTransactional
    public int save(LoginLogBO bo){
        bo.setId(Tool.getUUID());
        return loginLogDao.insert(bo);
    }
    
    @WriteTransactional
    public int delete(LoginLogBO bo){
        return loginLogDao.delete(bo);
    }
}
